<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>ECMAsctipt入门介绍</title>
</head>
<body>
    <!-- 简化的对象写法
    *省略同名的属性值
    省略方法的function
    例如:
        let x = 1;
        let y = 2;
        let point = {
            x,
            y,
            setX(x){
                this.x = x
            }
        } -->
    <script>
        let username = 'kobe';
        let age = 39;
        let obj = {
            username,
            age,
            // getName:function(){//有function的
            //     return this.username + this.age
            // },
            getName(){ //简写的
                return this.username + this.age
            }
        }
        console.log(obj)
        console.log(obj.getName())
    </script>
</body>
</html>